<template>
    <div>
    <form class="form-horizontal" role="form" @submit.prevent="resgister">
        <div class="form-group">
            <label for="name" class="col-md-4 control-label">用户名</label>
            <div class="col-md-6">
                <input v-model="username" id="name" type="text" class="form-control" name="username" value="" autofocus>
                                    <!--<span class="help-block">-->
                                        <!--<strong>333</strong>-->
                                    <!--</span>-->
            </div>
        </div>
        <div class="form-group" >
            <label for="email" class="col-md-4 control-label">邮箱</label>
            <div class="col-md-6">
                <input v-validate="{rules:{required:true,email:true}}"  v-model="email" id="email" type="email" class="form-control" name="email" value="">
                <span v-show="errors.has('email')">{{ errors.first('email') }}</span>
                <!--<span v-show="errors.has('email')" class="help-block">-->
                <!--<strong>333</strong>-->
                <!--</span>-->
            </div>
        </div>
        <div class="form-group">
            <label for="password" class="col-md-4 control-label">密码</label>

            <div class="col-md-6">
                <input  v-model="password" id="password" type="password" class="form-control" name="password">
            </div>
        </div>
        <div class="form-group">
            <label for="password-confirm" class="col-md-4 control-label">确认密码</label>
            <div class="col-md-6">
                <input id="password-confirm" type="password" class="form-control" name="password_confirmation">
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-6 col-md-offset-4">
                <button type="submit" class="btn btn-primary">
                    注册
                </button>
            </div>
        </div>
    </form>
    </div>
</template>

<script>
    export default {
        data(){
            return {
                username:'',
                email:'',
                password:''
            }
        },
        mounted() {},
        computed: {},
        methods:{
            resgister(){
                let formDate={
                    username:this.username,
                    email:this.email,
                    password:this.password,
                }
                axios.post('http://mg.com/auth/Apiregister',formDate).then((response) =>{
                    console.log(response.data)
                    this.$router.push({name:'comfirm'})
                })
            }
        },
        components: {}
    }
</script>